package com.wc.alorithm_blue_bridge._模拟.Q4583;

import java.util.Scanner;

/**
 * @Author congge
 * @Date 2023/11/9 21:00
 * 542857143
 * @description 小蓝的奇妙冒险
 * https://www.lanqiao.cn/problems/4583/learning/?page=1&first_category_id=1
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int r = sc.nextInt();
        int mod3 = r / 3;
        int mod5 = r / 5;
        int mod7 = r / 7;
        int mod15 = r / 15;
        int mod21 = r / 21;
        int mod35 = r / 35;
        int mod105 = r / 105;
        int ans = mod3 + mod5 + mod7 - mod15 - mod21 - mod35 + mod105;
        System.out.println(ans);
    }
}
